//
//  FastPaymentCell.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/8/17.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "FastPaymentCell.h"


@interface FastPaymentCell ()

@property (nonatomic, weak)UILabel * bankInfoLabel;
@property (nonatomic, weak)UILabel * useButton;
@property (nonatomic, weak)UIView * lineView;

@end

@implementation FastPaymentCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{
    
    self.backgroundColor = [UIColor clearColor];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UILabel * bankInfoLabel = [UILabel new];
    
    bankInfoLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:15 * SCREENH6];
    bankInfoLabel.textColor = ColorWithRGB(0xc8c8c8);
    
    self.bankInfoLabel = bankInfoLabel;
    
    [self.contentView addSubview:self.bankInfoLabel];
    
    
    [self.bankInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
    }];
    
    
    UILabel * useButton = [UILabel new];
    
    useButton.layer.borderColor = [ColorWithRGB(0xc8c8c8) CGColor];
    useButton.layer.borderWidth = 1 * SCREENH6;
    useButton.layer.cornerRadius =5.0f;
    useButton.text = @"使用";
    useButton.font = [UIFont systemFontOfSize:15 * SCREENH6];
    useButton.textColor = ColorWithRGB(0xc8c8c8);
    useButton.textAlignment = NSTextAlignmentCenter;
    
    self.useButton = useButton;
    
    [self.contentView addSubview:self.useButton];
    
    [self.useButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.height.mas_equalTo(25 * SCREENH6);
        make.width.mas_equalTo(70 * SCREENH6);
    }];
    
    
    UIView * lineView = [UIView new];
    
    lineView.backgroundColor = [UIColor whiteColor];
    lineView.alpha = 0.1;
    
    self.lineView = lineView;
    
    [self.contentView addSubview:self.lineView];
    
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1 * SCREENH6);
    }];
    
}


- (void)setModel:(FastPaymentModel *)model{
    
    _model = model;
    
    NSString * cardNo = [NSString stringWithFormat:@"%@",model.bankNo];
    
    NSString * bankName = [NSString stringWithFormat:@"%@",model.bankName];
    
    self.bankInfoLabel.text = [NSString stringWithFormat:@"%@(尾号%@)",bankName,cardNo];
    self.ID = model.ID;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
